import axios from '../utils/request'


// 封装一个获取购物车列表的数据请求
export function getCartList(data: { userid: string }) {
    return axios({
        url: '/cart/list',
        data,
        method: 'POST'
    })
}

// 购物车单条选择
export function selectoneFn(data: { flag: boolean, cartid: string }) {
    return axios({
        url: '/cart/selectone',
        data,
        method: 'POST'
    })
}

// 全选和取消全选
export function selectallFn(data: { type: boolean, userid: string }) {
    return axios({
        url: '/cart/selectall',
        data,
        method: 'POST'
    })
}

// 删除单条数据
export function removeFn(data: { cartid: string }) {
    return axios({
        url: '/cart/remove',
        data,
        method: 'POST'
    })
}



interface iD {
    userid: string
    proid: string
    num: number
}
// 加入购物车
export function addCartFn(data: iD) {
    return axios({
        url: '/cart/add',
        data,
        method: 'POST'
    })
}